import { http } from '@/utils/http'
import {
  CommunicateRecords,
  CourseModel,
  ParentDetailsModel,
  ParentListModel,
  StudentCoursesNumModel,
} from '@/models/historyMessageModels'
import { Pagination } from '@/models/sys'

/** 家长列表 */
export const crmContacts = (params: { keyword: string; page: number; per_page: number }) => {
  return http.get<[ParentListModel]>('/library-client/api/wxwork/crm/contacts', params)
}

/** 家长详情 */
export const contactDetail = (params: { id: number }) => {
  return http.get<ParentDetailsModel>('/library-client/api/wxwork/crm/contact-detail', params)
}

/** 历史沟通记录 */
export const crmRecords = (params: {
  student_id: number
  mobile: string
  is_only_show_mine: number
  page: number
  per_page: number
}) => {
  return http.get<Pagination<CommunicateRecords>>('/library-client/api/wxwork/crm/records', params)
}

/** 网校课程列表 */
export const onlineCourses = (params: {
  student_id: number
  is_only_show_mine: number
  page: number
  per_page: number
}) => {
  return http.get<Pagination<CourseModel>>('/library-client/api/wxwork/crm/online-courses', params)
}

/** 学校课程列表 */
export const offlineCourses = (params: {
  student_id: number
  is_only_show_mine: number
  page: number
  per_page: number
}) => {
  return http.get<Pagination<CourseModel>>('/library-client/api/wxwork/crm/offline-courses', params)
}

/** 书店课程列表 */
export const bookstoreCourses = (params: {
  student_id: number
  is_only_show_mine: number
  page: number
  per_page: number
}) => {
  return http.get<Pagination<CourseModel>>(
    '/library-client/api/wxwork/crm/bookstore-courses',
    params,
  )
}

/** 获取学生课程数 */
export const studentCoursesNum = (params: { student_id: number }) => {
  return http.get<StudentCoursesNumModel>(
    '/library-client/api/wxwork/crm/student-courses-num',
    params,
  )
}
